import { instance as request, http } from '@/utils/request'

/* export interface IReqLoginRes {
  code: number
  data: IReqLoginData
  message: string
  success: boolean
} */

export interface IReqLoginData {
  token: string
}

/* export interface IReqUserInfo{
  code: number
  data: IReqUserInfoDate
  message: string
  success: boolean
} */
export interface IReqUserInfoDate {
  routes: string[]
  buttons: string[]
  roles: string[]
  name: string
  avatar: string
}

//获取登录情况
export const reqLogin = (username: string, password: string) => {
  return http<IReqLoginData>('/admin/acl/index/login', 'POST', { username, password })
}

//获取用户信息
export const reqUserInfo = () => {
  return http<IReqUserInfoDate>('/admin/acl/index/info', 'GET')
}
/**
 * @description 退出登录
 * @returns Promise
 */
export const reqLoignOut = () => {
  return http('/admin/acl/index/logout', 'POST')
}
